<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机页面背景案例</title>
    <style>
        body {
            background: url(./images/desktop_1.jpg) no-repeat top center / cover;
        }
    </style>
</head>

<body>
    <script>
        const random = Math.floor((Math.random() * 10) + 1)
        document.body.style.backgroundImage = `url(./images/desktop_${random}.jpg)`
    </script>
</body>

</html>